//
//  LBCTabBarController.m
//  LifeEnjoy
//
//  Created by 刘表聪 on 15/9/9.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "LBCTabBarController.h"
#import "LBCHomeViewController.h"
#import "LBCCategoryViewController.h"
#import "LBCLifeViewController.h"
#import "LBCUserViewController.h"


@interface LBCTabBarController ()

@end

@implementation LBCTabBarController
#pragma mark - 初始化
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [self setUpChildViewController];
    }
    return self;
}

- (void)setUpChildViewController
{
    // 设置主页控制器
    LBCHomeViewController *homeVC = [LBCHomeViewController new];
    UINavigationController *homeNC = [[UINavigationController alloc] initWithRootViewController:homeVC];
    homeNC.tabBarItem.title = @"首页";
    homeNC.tabBarItem.image = [UIImage imageNamed:@"home.png"];
    [homeNC.navigationBar setBackgroundImage:[UIImage imageNamed:@"topImage.png"] forBarMetrics:UIBarMetricsDefault];
    
    // 设置分类控制器
    LBCCategoryViewController *categoryVC = [LBCCategoryViewController new];
    UINavigationController *categoryNC = [[UINavigationController alloc] initWithRootViewController:categoryVC];
    categoryNC.tabBarItem.title = @"分类";
    categoryNC.tabBarItem.image = [UIImage imageNamed:@"category.png"];
//    categoryNC.tabBarItem.selectedImage = [UIImage imageNamed:@""];
    [categoryNC.navigationBar setBarTintColor:[UIColor redColor]];
    
    // 设置生活频道控制器
    LBCLifeViewController *lifeVC = [LBCLifeViewController new];
    UINavigationController *lifeNC = [[UINavigationController alloc] initWithRootViewController:lifeVC];
    lifeNC.tabBarItem.title = @"生活频道";
    lifeNC.tabBarItem.image = [UIImage imageNamed:@"life.png"];
    [lifeNC.navigationBar setBarTintColor:[UIColor redColor]];
    
    // 设置我的控制器
    LBCUserViewController *userVC = [LBCUserViewController new];
    UINavigationController *userNC = [[UINavigationController alloc] initWithRootViewController:userVC];
    userNC.tabBarItem.title = @"我的";
    userNC.tabBarItem.image = [UIImage imageNamed:@"user.png"];
    [userNC.navigationBar setBarTintColor:[UIColor redColor]];
    
    
    // 设置子控制器
    self.viewControllers = @[homeNC, categoryNC, lifeNC, userNC];
    self.tabBar.barTintColor = [UIColor whiteColor];
    self.tabBar.selectedImageTintColor = [UIColor redColor];
    
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
